<template>
  <el-dropdown @command="changeLanguage" trigger="click">
    <div>
      <svg-icon icon-class="language" style="color:#606266;font-size:20px"></svg-icon>
    </div>
    <el-dropdown-menu slot="dropdown">
      <el-dropdown-item command="zh" :disabled="this.$i18n.locale === 'zh'">中文</el-dropdown-item>
      <el-dropdown-item command="en" :disabled="this.$i18n.locale === 'en'">EN</el-dropdown-item>
    </el-dropdown-menu>
  </el-dropdown>
</template>

<script>
import Cookie from 'js-cookie';
export default {
  methods: {
    changeLanguage(type) {
      Cookie.set('language', type);
      this.$i18n.locale = type;
      this.$message.success('切换多语言成功');
    },
  },
};
</script>

<style>
</style>
